<template>
    <div class="lse_loading_spin">
        <div class="lse_loading_spin_content">
            <div>
                <div v-if="type === 1" class="spinnerA">
                    <div class="rect1"></div>
                    <div class="rect2"></div>
                    <div class="rect3"></div>
                    <div class="rect4"></div>
                    <div class="rect5"></div>
                </div>
                <div v-else-if="type === 2" class="spinnerB">
                    <div class="bounce1"></div>
                    <div class="bounce2"></div>
                    <div class="bounce3"></div>
                </div>
                <div class="spinnerC" v-else-if="type === 3"></div>
                <div class="spinnerD spinnerD_js" v-else-if="type === 4">
                  <span class="binaryD"></span>
                  <span class="binaryD"></span>
                </div>
                <div class="loaderE" v-else-if="type === 5">
                  <div class="loader-innerE">
                    <div class="loader-line-wrapE">
                      <div class="loader-lineE"></div>
                    </div>
                    <div class="loader-line-wrapE">
                      <div class="loader-lineE"></div>
                    </div>
                    <div class="loader-line-wrapE">
                      <div class="loader-lineE"></div>
                    </div>
                    <div class="loader-line-wrapE">
                      <div class="loader-lineE"></div>
                    </div>
                    <div class="loader-line-wrapE">
                      <div class="loader-lineE"></div>
                    </div>
                  </div>
                </div>
                <div v-else-if="type === 6">
                  <div class="dotF"></div>
                  <div class="dotF"></div>
                  <div class="dotF"></div>
                  <div class="dotF"></div>
                  <div class="dotF"></div>
                </div>
            </div>
            <div style="margin-top: 10px;" class="tips">{{msg}}</div>
        </div>
    </div>
</template>

<script>
export default {
  name: 'Loading',
  data () {
    return {
      msg: this.message
    }
  },
  watch: {
    'message': function (e) {
      this.msg = e
    }
  },
  props: {
    message: {
      type: String,
      default: ''
    },
    type: {
      type: Number,
      default: 1
    }
  },
  methods: {},
  crated () {}
}
</script>

<style scoped>
/* 局部加载 */
.lse_loading_spin{
    width: 100%;
    height: 100%;
    position: absolute;
    text-align: center;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.6);
    z-index: 99999;
}
.lse_loading_spin_content{
    width: 100%;
    position: fixed;
    text-align: center;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
}

/* 加载动画 A */
.spinnerA {
  margin: auto;
  width: 50px;
  height: 60px;
  text-align: center;
  font-size: 10px;
}

.spinnerA > div {
  background-color: #409EFF;
  height: 100%;
  width: 6px;
  display: inline-block;
  -webkit-animation: stretchdelay 1.2s infinite ease-in-out;
  animation: stretchdelay 1.2s infinite ease-in-out;
}

.spinnerA .rect2 {
  -webkit-animation-delay: -1.1s;
  animation-delay: -1.1s;
}

.spinnerA .rect3 {
  -webkit-animation-delay: -1.0s;
  animation-delay: -1.0s;
}

.spinnerA .rect4 {
  -webkit-animation-delay: -0.9s;
  animation-delay: -0.9s;
}

.spinnerA .rect5 {
  -webkit-animation-delay: -0.8s;
  animation-delay: -0.8s;
}

@-webkit-keyframes stretchdelay {
  0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
  20% { -webkit-transform: scaleY(1.0) }
}

@keyframes stretchdelay {
  0%, 40%, 100% {
    transform: scaleY(0.4);
    -webkit-transform: scaleY(0.4);
  }
  20% {
    transform: scaleY(1.0);
    -webkit-transform: scaleY(1.0);
  }
}
/* 加载动画 B */
.spinnerB {
  margin: auto;
  width: 150px;
  text-align: center;
}
.spinnerB > div {
  width: 30px;
  height: 30px;
  background-color: #409EFF;
  border-radius: 100%;
  display: inline-block;
  -webkit-animation: bouncedelay 1.4s infinite ease-in-out;
  animation: bouncedelay 1.4s infinite ease-in-out;
  /* Prevent first frame from flickering when animation starts */
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
}

.spinnerB .bounce1 {
  -webkit-animation-delay: -0.32s;
  animation-delay: -0.32s;
}

.spinnerB .bounce2 {
  -webkit-animation-delay: -0.16s;
  animation-delay: -0.16s;
}

@-webkit-keyframes bouncedelay {
  0%, 80%, 100% { -webkit-transform: scale(0.0) }
  40% { -webkit-transform: scale(1.0) }
}

@keyframes bouncedelay {
  0%, 80%, 100% {
    transform: scale(0.0);
    -webkit-transform: scale(0.0);
  }
  40% {
    transform: scale(1.0);
    -webkit-transform: scale(1.0);
  }
}
/* 加载动画 C */
.spinnerC {
  width: 50px;
  height: 50px;
  margin: auto;
  background-color: #409EFF;
  border-radius: 100%;
  -webkit-animation: scaleout 1.0s infinite ease-in-out;
  animation: scaleout 1.0s infinite ease-in-out;
}

@-webkit-keyframes scaleout {
  0% { -webkit-transform: scale(0.0) }
  100% {
    -webkit-transform: scale(1.0);
    opacity: 0;
  }
}

@keyframes scaleout {
  0% {
    transform: scale(0.0);
    -webkit-transform: scale(0.0);
  }
  100% {
    transform: scale(1.0);
    -webkit-transform: scale(1.0);
    opacity: 0;
  }
}
/* 加载动画 D */
.spinnerD {
  width: 130px;
  height: 170px;
  position: relative;
  margin: auto;
}

.spinnerD::before, .spinnerD::after {
  content: "";
  width: 0;
  height: 0;
  position: absolute;
  bottom: 30px;
  left: 15px;
  z-index: 1;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 20px solid #1b2a33;
  transform: scale(0);
  transition: all 0.2s ease;
}
.spinnerD::after {
  border-right: 15px solid transparent;
  border-bottom: 20px solid #162229;
}
.spinnerD_js::before, .spinnerD_js::after {
  transform: scale(1);
}

.binaryD {
  width: 100%;
  height: 140px;
  display: block;
  position: absolute;
  top: 0;
  left: 15px;
  z-index: 2;
  overflow: hidden;
}
.binaryD::before, .binaryD::after {
  font-family: "Lato";
  font-size: 24px;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}
.binaryD:nth-child(1)::before {
  content: "0";
  animation: spinnerD_a 1.1s linear infinite;
}
.binaryD:nth-child(1)::after {
  content: "0";
  animation: spinnerD_b 1.3s linear infinite;
}
.binaryD:nth-child(2)::before {
  content: "1";
  animation: spinnerD_c 0.9s linear infinite;
}
.binaryD:nth-child(2)::after {
  content: "1";
  animation: spinnerD_d 0.7s linear infinite;
}

@keyframes spinnerD_a {
  0% {
  transform: translate(30px, 0) rotate(30deg);
    opacity: 0;
  }
  100% {
    transform: translate(30px, 150px) rotate(-50deg);
    opacity: 1;
  }
}
@keyframes spinnerD_b {
  0% {
    transform: translate(50px, 0) rotate(-40deg);
    opacity: 0;
  }
  100% {
    transform: translate(40px, 150px) rotate(80deg);
    opacity: 1;
  }
}
@keyframes spinnerD_c {
  0% {
    transform: translate(70px, 0) rotate(10deg);
    opacity: 0;
  }
  100% {
    transform: translate(60px, 150px) rotate(70deg);
    opacity: 1;
  }
}
@keyframes spinnerD_d {
  0% {
    transform: translate(30px, 0) rotate(-50deg);
    opacity: 0;
  }
  100% {
    transform: translate(45px, 150px) rotate(30deg);
    opacity: 1;
  }
}
/* 加载动画 E */
.loaderE {
  position: relative;
  bottom: 35px;
}

.loader-innerE {
    bottom: 0;
    height: 60px;
    left: 0;
    margin: auto;
    position: relative;
    right: 0;
    top: 0;
    width: 100px;
}

.loader-line-wrapE {
    animation: spinE 2000ms cubic-bezier(.175, .885, .32, 1.275) infinite;
    box-sizing: border-box;
    height: 50px;
    left: 0;
    overflow: hidden;
    position: absolute;
    top: 0;
    transform-origin: 50% 100%;
    width: 100px;
}
.loader-lineE {
    border: 4px solid transparent;
    border-radius: 100%;
    box-sizing: border-box;
    height: 100px;
    left: 0;
    margin: 0 auto;
    position: absolute;
    right: 0;
    top: 0;
    width: 100px;
}
.loader-line-wrapE:nth-child(1) { animation-delay: -50ms; }
.loader-line-wrapE:nth-child(2) { animation-delay: -100ms; }
.loader-line-wrapE:nth-child(3) { animation-delay: -150ms; }
.loader-line-wrapE:nth-child(4) { animation-delay: -200ms; }
.loader-line-wrapE:nth-child(5) { animation-delay: -250ms; }

.loader-line-wrapE:nth-child(1) .loader-lineE {
    border-color: hsl(0, 80%, 60%);
    height: 90px;
    width: 90px;
    top: 7px;
}
.loader-line-wrapE:nth-child(2) .loader-lineE {
    border-color: hsl(60, 80%, 60%);
    height: 76px;
    width: 76px;
    top: 14px;
}
.loader-line-wrapE:nth-child(3) .loader-lineE {
    border-color: hsl(120, 80%, 60%);
    height: 62px;
    width: 62px;
    top: 21px;
}
.loader-line-wrapE:nth-child(4) .loader-lineE {
    border-color: hsl(180, 80%, 60%);
    height: 48px;
    width: 48px;
    top: 28px;
}
.loader-line-wrapE:nth-child(5) .loader-lineE {
    border-color: hsl(240, 80%, 60%);
    height: 34px;
    width: 34px;
    top: 35px;
}

@keyframes spinE {
  0%, 15% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(360deg);
  }
}
/* 加载动画F */
.dotF {
  width:24px;
  height:24px;
  background:#3ac;
  border-radius:100%;
  display:inline-block;
  animation: slideF 1s infinite;
}
.dotF:nth-child(1){
    animation-delay: 0.1s;
    background:#32aacc;
}
.dotF:nth-child(2){
    animation-delay: 0.2s;
    background:#64aacc;
}
.dotF:nth-child(3){
    animation-delay: 0.3s;
    background:#96aacc;
}
.dotF:nth-child(4){
    animation-delay: 0.4s;
    background:#c8aacc;
}
.dotF:nth-child(5){
    animation-delay: 0.5s;
    background:#faaacc;
}

@keyframes slideF{
  0% {
    transform:scale(1);
  }
  50% {
    opacity: .3;
    transform: scale(2);
  }
  100% {
    transform: scale(1)
    }
  }
</style>
